package org.hentai.tool;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class EncodeUtil {
    public static String encodePassword(String password) throws NoSuchAlgorithmException {
        MessageDigest messageDigest = MessageDigest.getInstance("sha-256");
        messageDigest.update(password.getBytes());
        byte[] digest = messageDigest.digest();
        return String.format("%064x", new BigInteger(1, digest));
    }

    public static void main(String[] args) throws NoSuchAlgorithmException {
        String password = encodePassword("ynjmwszyxy123");

        System.out.println("username: ynjmwszyxy");
        System.out.println("password: " + password);
    }
}

